﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebSite.Dal.Entities;
using WebSite.Config.Attributes;
using NHibernate;

namespace WebSite.Controllers
{
    public class HomeController : Controller
    {
    	private readonly ISession _session;

    	public HomeController(ISession session)
    	{
    		_session = session;
    	}

    	[PatternRoute("")]
        public ActionResult Index()
        {
    		var users = _session.QueryOver<User>().List<User>().FirstOrDefault();

			ViewBag.Message = "Welcome to ASP.NET MVC!" + users.FirstName;

    		return View("~/Views/AnonymousHomepage.cshtml");
        }

		[PatternRoute("about")]
        public ActionResult About()
        {
            return View();
        }
    }
}
